package com.ymt.bpm.appboot;

import org.springframework.context.ApplicationContext;

/**
 * Created by Johnny on 2016/12/24.
 */
public class SpringContext {

    /**
     * ApplicationContext
     */
    private static ApplicationContext appContext;

    /**
     * ApplicationContext getter
     * @return
     */
    public static ApplicationContext getAppContext() {
        return appContext;
    }

    /**
     * ApplicationContext setter
     */
    public static void setAppContext(ApplicationContext appContext) {
        SpringContext.appContext = appContext;
    }

    public static <T> T getBean(Class<T> clazz) {
        return appContext.getBean(clazz);
    }

    public static <T> T getBean(String clazzName) {
        return (T)appContext.getBean(clazzName);
    }
}
